<template>
	<view class="password">
		<u-toast ref="uToast"></u-toast>
		<!-- <view class="input"><u--input border="none" v-model="addForm.mobile" placeholder="请输入手机号码" placeholder-style="color:#beebff" color="#fff"></u--input></view> -->
		<view class="input flex flex_align">
			<!-- <text class="iconfont icon-shouji1" style="color: #beebff;margin-right: 10rpx;font-size: 40rpx;"></text> -->
			<u--input border="bottom" v-model="addForm.mobile" prefixIcon="phone" placeholder="请输入手机号码"></u--input>
		</view>
		<view class="input mar_top"><u--input border="bottom" v-model="addForm.pwd" placeholder="请输入密码" password ></u--input></view>
	</view>
</template>

<script>
	import {
		login,
		mobilelogin
	} from '@/api/login.js'
	export default {
		data() {
			return {
				addForm: { platform: 2, pwd: '', mobile: "" }
			}
		},
		methods: {
			//账号登录
			getLogin() {
				let addForm = this.addForm
				login(addForm).then(res => {
					uni.setStorageSync("token", res.data.token)
					this.$store.commit('editToken',res.data.token)
					
					this.$store.commit('editMobile',res.data.mobile)
					uni.setStorageSync("mobile", res.data.mobile)
					
					uni.setStorageSync("expiretime", res.data.expiretime)
					this.$refs.uToast.show({
						message: '登录成功',
						icon: false,
						type: 'success',
						complete: function() {
							uni.switchTab({
								url: '/pages/index/index'
							});
						}
					})
				}).catch(err => {
					this.$refs.uToast.show({
						message: err.msg,
						type: 'error',
						icon: false
					})
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.password{
		.input{
			// background-color: #89dbff;
			border-radius: 16rpx;
			color: #fff;
			padding: 16rpx 20rpx;
		}
		.mar_tops{
			margin-top: 40rpx;
		}
	}
</style>
